package com.hxc.pay;

public interface CommonPayTemplate {

    /**
     *  查询订单接口
     * @param outTradeNo 商户订单号
     * @return
     *
        {
            "amount": {
                "currency": "CNY",
                "payer_currency": "CNY",
                "payer_total": 1,
                "total": 1
            },
            "appid": "wxdace645e0bc2cXXX",
            "attach": "",
            "bank_type": "OTHERS",
            "mchid": "1900006XXX",
            "out_trade_no": "44_2126281063_5504",
            "payer": {
                "openid": "o4GgauJP_mgWEWictzA15WT15XXX"
            },
            "promotion_detail": [],
            "success_time": "2021-03-22T10:29:05+08:00",
            "trade_state": "SUCCESS",
            "trade_state_desc": "支付成功",
            "trade_type": "JSAPI",
            "transaction_id": "4200000891202103228088184743"
        }
     */
    public String queryOrder(String outTradeNo);

    /**
     *
     * @param refund  退款金额
     * @param total   订单总金额
     * @param outTradeNo  商户订单号
     * @param outRefundNo  商户退款单号
     * @return

    {
        "refund_id": "50000000382019052709732678859",
        "out_refund_no": "1217752501201407033233368018",
        "transaction_id": "1217752501201407033233368018",
        "out_trade_no": "1217752501201407033233368018",
        "channel": "ORIGINAL",
        "user_received_account": "招商银行信用卡0403",
        "success_time": "2020-12-01T16:18:12+08:00",
        "create_time": "2020-12-01T16:18:12+08:00",
        "status": "SUCCESS",
        "funds_account": "UNSETTLED",
        "amount": {
            "total": 100,
            "refund": 100,
            "from": [
                {
                "account": "AVAILABLE",
                "amount": 444
                }
            ],
            "payer_total": 90,
            "payer_refund": 90,
            "settlement_refund": 100,
            "settlement_total": 100,
            "discount_refund": 10,
            "currency": "CNY"
        },
        "promotion_detail": [
        {
        "promotion_id": "109519",
        "scope": "SINGLE",
        "type": "DISCOUNT",
        "amount": 5,
        "refund_amount": 100,
        "goods_detail": [
        {
        "merchant_goods_id": "1217752501201407033233368018",
        "wechatpay_goods_id": "1001",
        "goods_name": "iPhone6s 16G",
        "unit_price": 528800,
        "refund_amount": 528800,
        "refund_quantity": 1
        }
        ]
        }
        ]
    }
     */
    public String refund(Integer refund,Integer total,String outTradeNo,String outRefundNo);


    /**
     *
     * @param outTradeNo 商户订单号
     * 无数据（Http状态码为204）
     */
    public void close(String outTradeNo);
}
